package io.renren.modules.pallettable.service.impl;

import io.renren.modules.m.entity.MaterialEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.pallettable.dao.PallettableDao;
import io.renren.modules.pallettable.entity.PallettableEntity;
import io.renren.modules.pallettable.service.PallettableService;


@Service("pallettableService")
public class PallettableServiceImpl extends ServiceImpl<PallettableDao, PallettableEntity> implements PallettableService {
    @Autowired
    PallettableDao pallettableDao;


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String ptype =(String) params.get("key");
        String input = (String) params.get("input");

        QueryWrapper<PallettableEntity> queryWrapper = new QueryWrapper<PallettableEntity>();

        if (ptype != null && !ptype.isEmpty()) {
            queryWrapper.like("ptype", ptype);
        }

        if (input != null && !input.isEmpty()) {
            queryWrapper.like("pname", input);
        }

        IPage<PallettableEntity> page = this.page(
                new Query<PallettableEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }

}